// main.go
package main

import (
	"fmt"
	"ginweb/internal/app"
	"ginweb/internal/controller"
	"ginweb/internal/domain/user"
	"ginweb/internal/infrastructure/db"
	"ginweb/internal/service/command"
	"ginweb/internal/service/query"
)

func main() {
	// Initialize dependencies
	db.InitDB()
	db.Migrate()

	// Initialize repositories
	userRepo := user.NewRepository()

	// Initialize services
	userService, err := command.NewUserService(userRepo) // 接收两个返回值
	if err != nil {
		fmt.Printf("Failed to initialize UserService: %v\n", err)
		return
	}
	userQueryService := query.NewUserService(userRepo)

	// Initialize controllers
	userController := controller.NewUserController(userService, userQueryService) // 传递两个服务

	// Start server
	app.StartServer(userController, nil)
}
